home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6931 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: peer-news.britain.eu.net!warwick!kinguni!k930459
  2. From: k930459@kingston.ac.uk (Mark Sukhija)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Question on argv
  5. Date: 16 Feb 1996 12:30:42 GMT
  6. Organization: Kingston University, Kingston-upon-Thames.
  7. Message-ID: <4g1tdi$6j6@mercury.kingston.ac.uk>
  8. References: <4eoq3c$45j@usenet.ucs.indiana.edu> <harmon.823153381@pegasus.montclair.edu> <TANMOY.96Feb10160209@qcd.lanl.gov>
  9. NNTP-Posting-Host: ceres.king.ac.uk
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov) wrote:
  13. : In article <harmon.823153381@pegasus.montclair.edu>
  14. : harmon@pegasus.montclair.edu (Derek Harmon) writes: 
  15. : <snip: I didn't read the rest: so do not know what is being attempted here>
  16.  
  17. : #ifdef BIG_ENDIAN
  18. :    argv[0] = hiBYTE(i);
  19. :    argv[1] = loBYTE(i);
  20. : #else
  21. :    argv[0] = loBYTE(i);
  22. :    argv[1] = hiBYTE(i);
  23. : #endif
  24. :  
  25. :    /* when printing, typecast argv[4] as a (int *).  any reference to it   */
  26. :    /* as a string hereafter will be erroneous and possibly (if < 10) fatal */
  27. :  
  28. :       printf("argv[4] = %d\n", (int *)argv[4]);
  29.  
  30. %d expects an integer not an (int*)  What you should do here is:
  31.  
  32.         printf("argv[4] = %d\n", atoi(argv[4]));
  33.  
  34. Nothing guarentees that argv can actually be modified.
  35. --
  36. Mark Sukhija
  37. k930459@ceres.king.ac.uk
  38. Work is the curse of the drinking classes.
  39.  
  40.